﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using OA.Model;
using OA.Utility;

namespace OA.Bll.Personnel
{
    public class PassportPresenter : BasePresenter<PassportInfo>
    {
        public new string Search(JsonReq req)
        {
            int pageIndex = Convert.ToInt32(req["page"]);
            int pageSize = Convert.ToInt32(req["rows"]);
            int total = 0;
            //T info = JsonHelper.JsonDeserialize<T>(req.Options);
            string sql = JsonHelper.GetQueryFilterString(req.Options);
            Type type = typeof(PassportViewInfo);
            if (type.GetProperties().Count(a => a.Name.ToLower() == "Id") > 0)
                sql += " order by  Id desc";
            DataTable dt = new Manager.ManagerParent<PassportViewInfo>().GetSearchPaged(sql, pageIndex, pageSize,
                                                                                      ref total);
            return JsonHelper.OnDataGrid(dt, total);
        }
    }
}
